<div class="page  page-full animation-fade page-menu">
    <div class="page-content">
        <div class="panel">
            <div class="panel-heading">
                <h3 class="panel-title">机构列表</h3>
                <div class="panel-actions" id="orgToolbar">
                    <a href="#" class="btn btn-info" data-toggle="extBtnSearch" title="查询">
                        <i class="fa fa-filter"></i> 查询
                    </a>
                    <a class="btn btn-primary" href="${base}/admin/sys/org/create" data-toggle="add">
                        <i class="fa fa-plus"></i> 添加机构
                    </a>
                    <a class="btn btn-primary" href="${base}/admin/sys/org/edit?id={{id}}" data-toggle="edit">
                        <i class="fa fa-pencil-square-o" aria-hidden="true"></i> 编辑
                    </a>
                    <a class="btn btn-danger" href="${base}/admin/sys/org/del" href="#" data-toggle="del">
                        <i class="fa fa-trash-o" aria-hidden="true"></i> 删除
                    </a>
                </div>
            </div>

            <div class="panel-body">
                <div class="list-filter-form">
                    <@bolt.queryForm path="system" id="query_org_form" dataGrid="sys_org_table"></@bolt.queryForm>
            </div>
            <table id="sys_org_table">
                <thead>
                <tr>
                    <th data-options="{field:'name', align:'center', width:250, rule:'required'}">名称</th>
                    <th data-options="{field:'areaName', align:'center', width:120}">所在区域</th>
                    <th data-options="{field:'tel', align:'center', width:120}">电话</th>
                    <th data-options="{field:'email', align:'center', width:150}">邮箱</th>
                    <th data-options="{field:'enabled',align:'center', width:100,formatter:Page.Org.state}">是否可用</th>
                    <th data-options="{field:'id',align:'center', width:200,formatter:Page.Org.Operation}">操作</th>
                </tr>
                </thead>
            </table>
        </div>
    </div>
</div>


</div>
<script type="text/javascript">

    $.namespace('Page.Org');

    Page.Org = function () {
        return {
            init: function () {
                Page.Org.initTreeTable();
            },
            initTreeTable: function () {

                $('#sys_org_table').boltDataGrid({

                    width:'100%',
                    height:'full-220',
                    toolbar: '#orgToolbar',
                    treeView: true,
                    paging: false,
                    dataUrl: '${base}/admin/sys/org/getOrgList'
                })
            },
            Operation:function (value, data) {
                var $html = Bolt.StrBuilder();
                $html.add('<div data-toggle="rowToolbar">');
                $html.add('<a class="btn btn-info" href="${base}/admin/sys/org/edit?id={{id}}" data-toggle="edit">编辑</a>');
                $html.add('<a class="btn btn-danger" href="${base}/admin/sys/org/del" data-toggle="del">删除</a>');
                $html.add('</div>');
                return $html.toString();
            },
            state: function (data) {

                if (data) {
                    return '<span class="label  label-primary ">已启用</span>';
                } else {
                    return '<span class="label label-warning">已禁用</span>';
                }

            }
        }
    }();


    $(document).ready(function () {
        Page.Org.init();
    });
</script>


